<template>
	<view>
		<u-navbar height="50" back-icon-color="#333" title="添加银行卡" title-color="#333" title-size="36">
		</u-navbar>
		<view class="explain">
			注：为了您的账户收益权益，请确保填写的银行卡信息真实有效，
			它将成为您收益提现的唯一到账银行卡账户，一经提交后不可修改。
		</view>
		<view class="layoutView">
			<view class="layoutTitle">请添加持卡人本人的银行卡</view>
			<view class="inputView">
				<text>持卡人</text>
				<input placeholder="请输入持卡人姓名" v-model="cardholder" />
			</view>
			<view class="line"></view>
			<view class="inputView">
				<text>卡号</text>
				<input placeholder="请输入银行账号" type="number" v-model="bank_card_number" />
			</view>
			<view class="line"></view>
			<view class="inputView">
				<text>开户行</text>
				<input placeholder="请输入开户银行" v-model="bank_name" />
			</view>
		</view>
		<view class="postView" @click="onPostData()">确认提交</view>
	</view>
</template>

<script>
	import { toast } from '../../utils/common';
	export default {
		data() {
			return {
				cardholder: '',
				bank_name: '',
				bank_card_number: '',
			}
		},
		methods: {
			onPostData() {
				let self = this;
				if (!this.cardholder) {
					toast('请输入持卡人姓名');
					return
				}
				if (!this.bank_card_number) {
					toast('请输入银行账号');
					return
				}
				if (!this.bank_name) {
					toast('请选择开户银行');
					return
				}
				// bankCardAdd({
				// 	cardholder: this.cardholder,
				// 	bank: this.bank_name,
				// 	bank_card_number: this.bank_card_number
				// }, true).then(res => {
				// 	toast('添加成功');
				// 	setTimeout(function() {
				// 		uni.navigateBack({
				// 			delta: 1
				// 		});
				// 	}, 500);
				// });
			}
		}
	}
</script>

<style>
	@import url('add-card.css');

	page {
		background: #F2F2F2;
	}
</style>
